
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Instruction Tightly Integrated Memory &#8212; Freedom Metal v201905 documentation</title>
    <link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="Physical Memory Protection" href="pmps.html" />
    <link rel="prev" title="Interrupt Handlers" href="interrupts.html" />
   
  <link rel="stylesheet" href="../_static/custom.css" type="text/css" />
  
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

  </head><body>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          

          <div class="body" role="main">
            
  <div class="section" id="instruction-tightly-integrated-memory">
<h1>Instruction Tightly Integrated Memory<a class="headerlink" href="#instruction-tightly-integrated-memory" title="Permalink to this headline">¶</a></h1>
<p>The Instruction Tightly Integrated Memory (ITIM) is an optional feature
on certain SiFive RISC-V CPUs. The ITIM is a memory device which is
optimized in the CoreIP memory heirarchy to provide low-latency
access to instruction memory.</p>
<p>Freedom Metal provides the ability to designate functions to run out of
the ITIM by decorating the functions with the following “decorator”:</p>
<dl class="macro">
<dt id="c.METAL_PLACE_IN_ITIM">
<span class="target" id="itim_8h_1adc7154309c0e245ae246c435665eebb6"></span><code class="descname">METAL_PLACE_IN_ITIM</code><a class="headerlink" href="#c.METAL_PLACE_IN_ITIM" title="Permalink to this definition">¶</a></dt>
<dd><p>Link a function into the ITIM. </p>
<p>Link a function into the ITIM (Instruction Tightly Integrated Memory) if the ITIM is present on the target device. </p>
</dd></dl>

<p>For example:</p>
<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="n">METAL_PLACE_IN_ITIM</span>
<span class="kt">void</span> <span class="nf">my_itim_func</span><span class="p">()</span> <span class="p">{</span>
   <span class="cm">/* This code will run out of the ITIM */</span>
<span class="p">}</span>
</pre></div>
</div>
<div class="section" id="caveats">
<h2>Caveats<a class="headerlink" href="#caveats" title="Permalink to this headline">¶</a></h2>
<p>The <code class="docutils literal notranslate"><span class="pre">METAL_PLACE_IN_ITIM</span></code> decorator tells the toolchain to link the
decorated function into the ITIM memory. However, compiler optimizations
such as function inlining may cause execution to never transfer to
instructions fetched from the ITIM.</p>
<p>If this compiler optimization is not desired, one workaround is to
tell the compiler to not inline the function:</p>
<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="n">__attribute__</span><span class="p">((</span><span class="n">noinline</span><span class="p">))</span>
<span class="n">METAL_PLACE_IN_ITIM</span>
<span class="kt">void</span> <span class="n">my_itim_func</span><span class="p">()</span> <span class="p">{</span>
   <span class="cm">/* This code will run out of the ITIM */</span>
<span class="p">}</span>
</pre></div>
</div>
</div>
</div>


          </div>
          
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="../index.html">Freedom Metal</a></h1>








<h3>Navigation</h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../introduction.html">Introduction to Freedom Metal</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../devguide.html">Developer Guide</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="exceptions.html">Exception Handlers</a></li>
<li class="toctree-l2"><a class="reference internal" href="fe310-g000-pll.html">FE310-G00 PLL</a></li>
<li class="toctree-l2"><a class="reference internal" href="interrupts.html">Interrupt Handlers</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Instruction Tightly Integrated Memory</a></li>
<li class="toctree-l2"><a class="reference internal" href="pmps.html">Physical Memory Protection</a></li>
<li class="toctree-l2"><a class="reference internal" href="tty.html">Standard I/O</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../api.html">API Reference</a></li>
</ul>

<div class="relations">
<h3>Related Topics</h3>
<ul>
  <li><a href="../index.html">Documentation overview</a><ul>
  <li><a href="../devguide.html">Developer Guide</a><ul>
      <li>Previous: <a href="interrupts.html" title="previous chapter">Interrupt Handlers</a></li>
      <li>Next: <a href="pmps.html" title="next chapter">Physical Memory Protection</a></li>
  </ul></li>
  </ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy;2019, SiFive Inc..
      
      |
      Powered by <a href="http://sphinx-doc.org/">Sphinx 1.7.5</a>
      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.11</a>
      
      |
      <a href="../_sources/devguide/itim.rst.txt"
          rel="nofollow">Page source</a>
    </div>

    

    
  </body>
</html>